import { App } from 'vue';
import { registerControlProvider } from '@ibiz-template/runtime';
import { ResourceScheduleTable } from './resource-schedule-table';
import { ResourceScheduleTableProvider } from './resource-schedule-table.provider';
import resourceScheduler from './resource-scheduler';

export default {
  install(app: App): void {
    app.use(resourceScheduler);
    // 全局注册部件插件组件
    app.component(ResourceScheduleTable.name!, ResourceScheduleTable);
    // 全局注册部件插件适配器，CUSTOM是插件类型，RESOURCE_SCHEDULER是插件标识
    registerControlProvider(
      'CUSTOM_RESOURCE_SCHEDULER',
      () => new ResourceScheduleTableProvider(),
    );
  },
};
